package team.xiaobaiya.gptchatrobot.exception;

import team.xiaobaiya.gptchatrobot.util.Resp;
import team.xiaobaiya.gptchatrobot.util.RespCodeEnum;

/**
 * @ClassName AbstractDirectRespException
 * @Author Feng Yingnan
 * @Email fengyn1211@163.com
 * @Date 2023/4/7 9:11
 */
public abstract class AbstractDirectRespException extends RuntimeException{
    private final RespCodeEnum respCode;

    protected AbstractDirectRespException(RespCodeEnum respCode, String extMsg) {
        super(respCode.msg() + "," + extMsg);
        this.respCode = respCode;
    }

    public Resp resp() {
        return Resp.error(respCode);
    }
}
